<?php

class Student_Model_DbTable_Assessment extends Zend_Db_Table_Abstract {

	protected $_name = 'assessment';
        //protected $_course = 'student_course';


        public function getAssessment($id)
        {
            $id = (int)$id;
            $row = $this->fetchRow('id = ' . $id);
            if (!$row)
                {
                    throw new Exception("Count not find row $id");
                }
            return $row->toArray();
        }

         public function getSingleUserAssessments($course_id)
        {
            $course_id = (int)$course_id;
            $row = $this->fetchAll('id_of_course = ' . $course_id);

            if (!$row)
                {
                    throw new Exception("Count not find row $course_id");
                }
            return $row;
        }

        public function getAssessDetails($assess_id)
        {
            $assess_id = (int)$assess_id;
            $row = $this->fetchAll('id = ' . $assess_id);
            if (!$row)
                {
                    throw new Exception("Count not find row $assess_id");
                }
            return $row;
        }
        


	public function addAssessment($assess_name, $assess_weight, $id_of_course, $num_of_assign)
        {

		$data = array (
		 'assess_name' => $assess_name,
                 'assess_weight' => $assess_weight,
                 'id_of_course' => $id_of_course,
                 'num_of_assign' => $num_of_assign,
                 
		);
		$this->insert($data);
	}


        public function updateAssessment($id, $assess_name, $assess_weight, $num_of_assign)
        {
            $data = array (
                 'id' => $id,
		 'assess_name' => $assess_name,
                 'assess_weight' => $assess_weight,
                 'num_of_assign' => $num_of_assign,
                 
		);

            $this->update($data, 'id = '. (int)$id);
        }


        public function deleteAssessment($id)
        {
            $this->delete('id =' . (int)$id);
        }

}